/*
 * @Author: 郑亮 z17620994877@163.com
 * @Date: 2024-04-03 11:35:52
 * @LastEditors: 郑亮 z17620994877@163.com
 * @LastEditTime: 2024-04-11 16:31:29
 * @FilePath: \my-maple-flower-app\vite.config.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path';
import postcssPxtoRem from 'postcss-pxtorem';

export default defineConfig(({ command, mode }) => {
  const env = loadEnv(mode,'')
  return {
    server: {
      proxy: {
        '/api': {
          target: 'http://www.zl6.top'
        }
      }
    },
    plugins: [
      vue(),
    ],
    resolve: {
      alias: {
        "@": path.resolve(__dirname, 'src/views')
      }
    },
    css: {
      postcss: {
        plugins: [
          postcssPxtoRem({
            rootValue: 75, // 按照自己的设计稿修改 1920/10
            unitPrecision: 5, // 保留到5位小数
            selectorBlackList: ['ignore', 'tab-bar', 'tab-bar-item'],  // 忽略转换正则匹配项
            propList: ['*'],
            replace: true,
            mediaQuery: false,
            minPixelValue: 0
          })
        ]
      }
    }
  }
})
